<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>用户全局配置管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			 
			$("#name").focus();
			
			var val  = '${userDefine.regLottery}';
			if(val != "1"){
				val ="0";
			} 
			
			$("input[type='radio'][name='regLottery'][value='"+val+"']").attr("checked", "checked");
					
					
			var signSwitch  = '${userDefine.signSwitch}';
			signSwitch = (signSwitch!="1") ? "0" :"1";
			$("input[type='radio'][name='signSwitch'][value='"+signSwitch+"']").attr("checked", "checked");
			
			var exchangeSwitch  = '${userDefine.exchangeSwitch}';
			exchangeSwitch = (exchangeSwitch!="1") ? "0" :"1";
			$("input[type='radio'][name='exchangeSwitch'][value='"+exchangeSwitch+"']").attr("checked", "checked");
			
			var couponSwitch  = '${userDefine.couponSwitch}';
			couponSwitch = (couponSwitch!="1") ? "0" :"1";
			$("input[type='radio'][name='couponSwitch'][value='"+couponSwitch+"']").attr("checked", "checked");
			
			
			var couponTypeSwitch  = '${userDefine.couponTypeSwitch}';
			couponTypeSwitch = (couponTypeSwitch!="1") ? "0" :"1";
			$("input[type='radio'][name='couponTypeSwitch'][value='"+couponTypeSwitch+"']").attr("checked", "checked");
			
			var siteStyle = '${userDefine.siteStyle}';
			   if(siteStyle =='') siteStyle ="0";
			   $("input[name='siteStyle'][value="+siteStyle+"]").attr("checked","checked");  
					
			$("#inputForm").validate({
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					
					
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
		});
		
		
		function changeReglotteryFlag(){
			var check = $('#regLottery');
			if(check.attr("checked") == "checked"){
				check.val("1");
				alert("change=checked=>"+check.val());
			}else{
				check.removeAttr("checked");
				check.val("0");
			}
			
			alert("change="+check.val());
			
		}
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<shiro:hasPermission name="sys:user:edit"><li><a href="${ctx}/wechat/userDefine/">用户全局配置列表</a></li></shiro:hasPermission>
		<li class="active"><a href="${ctx}/wechat/userDefine/form?id=${userDefine.id}">用户全局配置<shiro:hasPermission name="wechat:userDefine:edit">${not empty userDefine.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="wechat:userDefine:edit">查看</shiro:lacksPermission></a></li>
		<li ><a href="${ctx}/wechat/userDefine/signUpForm?id=${userDefine.id}">用户签到设置<shiro:hasPermission name="wechat:userDefine:edit">${not empty userDefine.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="wechat:userDefine:edit">查看</shiro:lacksPermission></a></li>
		<li ><a href="${ctx}/wechat/signupConfig/form">连续签到配置</a></li>
		<li ><a href="${ctx}/wechat/userDefine/guestBookForm?id=${userDefine.id}">用户留言板设置<shiro:hasPermission name="wechat:userDefine:edit">${not empty userDefine.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="wechat:userDefine:edit">查看</shiro:lacksPermission></a></li>
		<li ><a href="${ctx}/wechat/userDefine/registerForm?id=${userDefine.id}">会员申请设置<shiro:hasPermission name="wechat:userDefine:edit">${not empty userDefine.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="wechat:userDefine:edit">查看</shiro:lacksPermission></a></li>
		<li ><a href="${ctx}/wechat/userDefine/recommendForm?id=${userDefine.id}">推荐人设置<shiro:hasPermission name="wechat:userDefine:edit">${not empty userDefine.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="wechat:userDefine:edit">查看</shiro:lacksPermission></a></li>	
	</ul>
	<form:form id="inputForm" modelAttribute="userDefine" action="${ctx}/wechat/userDefine/save" method="post" class="form-horizontal"  enctype="multipart/form-data">
		<form:hidden path="id"/>
		<form:hidden path="user.id"/>
		<form:hidden path="regMemberTitle"/>
		<form:hidden path="regMemberPic"/>
		<form:hidden path="regMemberDesc"/>
		<form:hidden path="regLottery"/>
		<form:hidden path="registerScore"/>
		<form:hidden path="registerMoney"/>
		<form:hidden path="lotteryValidDays"/>
		<form:hidden path="lotteryName"/>
		<form:hidden path="lotteryTitle"/>
		<form:hidden path="lotteryDesc"/>
		<form:hidden path="recommendScore"/>
		<form:hidden path="recommendMoney"/>


		<form:hidden path="guestBookTitle"/>
		<form:hidden path="guestBookPic"/>
		<form:hidden path="guestBookDesc"/>


		<form:hidden path="signScore"/>
		<form:hidden path="signupTitle"/>
		<form:hidden path="signupPic"/>
		<form:hidden path="signupDesc"/>
		<form:hidden path="signSwitch"/>
		<form:hidden path="signSwitchDesc"/>
		<tags:message content="${message}"/>
		<div class="control-group">
			<label class="control-label">名称:</label>
			<div class="controls">
				<form:input path="name" htmlEscape="false" maxlength="11" class=""/>	<span class="alert">用户名称或店面名称</span>
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label">会员中心模板:</label>
			<div class="controls">
				<select name="siteStyle">
					<option value="default">默认</option>
					<option value="fashion">时尚新模板</option>
				</select>
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label">版权信息:</label>
			<div class="controls">
				<form:textarea path="footer" htmlEscape="false" rows="3" cols="5"/> <span class="alert">页面最底部显示的信息</span>
			</div>
		</div>
		
		
		
		<div class="control-group">
			<label class="control-label">兑换活动是否开启:</label>
			<div class="controls">
				<input type="radio" name="exchangeSwitch"  value="1"/>是 &nbsp;<input type="radio" name="exchangeSwitch"  value="0"/>否
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">兑换活动关闭描述:</label>
			<div class="controls">
				<form:textarea path="exchangeSwitchDesc" htmlEscape="false" rows="3" cols="5"/> <span class="alert">兑换活动停止后的说明信息</span>
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label">优惠券活动是否开启:</label>
			<div class="controls">
				<input type="radio" name="couponSwitch"  value="1"/>是 &nbsp;<input type="radio" name="couponSwitch"  value="0"/>否
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">优惠券活动关闭描述:</label>
			<div class="controls">
				<form:textarea path="couponSwitchDesc" htmlEscape="false" rows="3" cols="5"/> <span class="alert">优惠券活动停止后的说明信息</span>
			</div>
		</div>
		
		
		<div class="control-group">
			<label class="control-label">二维码全局通知信息:</label>
			<div class="controls">
				<form:textarea path="qrcodeMessage" htmlEscape="false" rows="3" cols="5"/> <span class="alert">所有二维码页面显示的信息,一般设置为空</span>
			</div>
		</div>
		
		
		<div class="control-group">
			<label class="control-label">优惠券类型查询是否开启:</label>
			<div class="controls">
				<input type="radio" name="couponTypeSwitch"  value="1"/>是 &nbsp;<input type="radio" name="couponTypeSwitch"  value="0"/>否
			</div>
		</div>
		
		
		<shiro:hasPermission name="score:scoreExchange:edit">
		
		<div class="control-group">
			<label class="control-label">兑换回复二维码标题:</label>
			<div class="controls">
				<form:input path="exchangeTitle" htmlEscape="false" maxlength="11" class=""/> <span class="alert">积分兑换回复时的二维码标题</span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">兑换回复二维码描述:</label>
			<div class="controls">
				<form:textarea path="exchangeDesc" htmlEscape="false" rows="3" cols="5"/> <span class="alert">积分兑换回复时的二维码描述</span>
			</div>
		</div>
		</shiro:hasPermission>
		
		
		
		
		
		<div class="form-actions">
			<shiro:hasPermission name="wechat:userDefine:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;</shiro:hasPermission>
			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
		</div>
	</form:form>
</body>
</html>
